import dayjs from 'dayjs'
// 手机号验证
const validatePhone = (value) => {
  return /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(value)

}

// 手机号码和固定电话验证
const validatePhoneOrNum = (value) => {
  return /^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$/.test(value)
}


// 身份证号验证
const validateIdCard = (value) => {
  return /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(value)
}



export default {

  phone: [
    { validator: validatePhone, message: '请输入正确的手机号码' }
  ],
  phoneOrNum: [
    { validator: validatePhoneOrNum, message: '请输入正确的联系方式' }
  ],
 
  idCard: [
    { validator: validateIdCard,message: '请输入正确的身份证号码' }
  ],
  

}
